package model

import (
	"gorm.io/gorm"
	"time"
)

type Order struct {
	Id        uint32         `gorm:"column:id;type:int UNSIGNED;comment:订单id;primaryKey;not null;" form:"id" json:"id"`                          // 订单id
	UserId    int32          `gorm:"column:user_id;type:int;comment:用户id;not null;" form:"user_id" json:"user_id"`                               // 用户id
	Price     float64        `gorm:"column:price;type:decimal(10, 2);comment:订单金额;not null;" form:"price" json:"price"`                          // 订单金额
	Status    int8           `gorm:"column:status;type:tinyint(1);comment:订单状态 0:正常 1:进行中 2:完成;not null;default:0;" form:"status" json:"status"` // 订单状态 0:正常 1:进行中 2:完成
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" form:"created_at" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" form:"updated_at" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" form:"deleted_at" json:"deleted_at"`
}

func (o Order) TableName() string {
	return "order"
}
